/**
 * const { proxy2 } = getCurrentInstance() 或 const { proxy } = useApi();
 * proxy2.$goto('/t-ui-plus/module-form/edit', { type: "edit" })
 * proxy.$goto('/t-ui-plus/module-form/edit', { type: "edit" }, router)
 */

import {Router, useRouter} from 'vue-router';
import { ref } from 'vue';
export default {
    install(app: any) {
        app.config.globalProperties.$goto = function(path: any, query: any, mRouter: Router) {
            const router =  useRouter();
            router.push({
                path: path,
                query: query
            }).catch(err => {
                if (err.name !== 'NavigationDuplicated') throw err;
            });
        };
    }
};